package com.sponge.utils;

public class StringUtils {

    private String upperCaseFirstLetter(String str){
        char[] strChar=str.toCharArray();
        strChar[0] -= 32;
        return String.valueOf(strChar);
    }


    public String getSetterName(String columnName){
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("set");
        if (columnName.indexOf("_") > 0){
            String[] split = columnName.split("_");
            for (String str : split) {
                stringBuilder.append(upperCaseFirstLetter(str));
            }
        }else{
            stringBuilder.append(upperCaseFirstLetter(columnName));
        }
        return stringBuilder.toString();
    }

}
